import { DefaultContext, title, result, desc } from '@knno/web';

@title('关于')
export default class {
	@desc('返回一个HTML表格,展示服务器的环境变量')
	@result('HTML 表格')
	async get(ctx: DefaultContext): Promise<void> {
		await ctx.render(() => {
			return (
				<table style={{ tableLayout: 'fixed' }}>
					<tr>
						<th style={{ width: '30%' }}>Key</th>
						<th style={{ width: '70%' }}>Value</th>
					</tr>
					{Object.keys(process.env)
						.sort()
						.map((key) => (
							<tr>
								<td>{key}</td>
								<td>{process.env[key]}</td>
							</tr>
						))}
				</table>
			);
		});
	}
}
